const app = getApp();
Component({
	/**
	 * 组件的一些选项
	 */
	options: {
		addGlobalClass: true,
		multipleSlots: true
	},
	/**
	 * 组件的对外属性
	 */
	properties: {
		bgColor: {
			type: String,
			default: ''
		},
		isCustom: {
			type: [Boolean, String],
			default: false
		},
		isBack: {
			type: [Boolean, String],
			default: false
		},
		bgImage: {
			type: String,
			default: ''
		},
		dfPage: {
			type: String,
			default: ''
		}
	},
	/**
	 * 组件的初始数据
	 */
	data: {
		StatusBar: app.globalData.StatusBar,
		CustomBar: app.globalData.CustomBar,
		Custom: app.globalData.Custom,
		mainHome: app.globalData.home
	},
	/**
	 * 组件的方法列表
	 */
	methods: {
		BackPage(e) {
			let _this = this;
			let dfPage = e.currentTarget.dataset.dfpage;
			wx.navigateBack({
				delta: 1,
				fail: function(e){
					if(e.errMsg == "navigateBack:fail cannot navigate back at first page."){
						if(dfPage != ""){
							_this.toPage(dfPage);
						}else{
							_this.toHome();
						}
					}
				}
			});
		},
		toHome() {
			wx.reLaunch({
				url: app.globalData.page_home,
			})
		},
		toPage(p) {
			wx.reLaunch({
				url: p,
			})
		}
	}
})